﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace thailandProject.ViewModel
{
    public class ApartmentReservation
    {
        public DateTime startDate { get; set; }
        public DateTime endDate { get; set; }
        public string propName { get; set; }
        public string clientFirstName { get; set; }
        public string clientLastName { get; set; }
        public decimal quotedPrice { get; set; }
        public decimal paid { get; set; }

    }

    public class ApartmentSelectModel
    {
        public string selectedProp { get; set; }
        public IEnumerable<SelectListItem> properties { get; set; }
    }

    public class ApartmentReservationModel
    {

        public List<ApartmentReservation> report { get; set; }
        public ApartmentSelectModel prop = new ApartmentSelectModel();
        public ApartmentReservationModel()
        {

            prop.selectedProp = "All";
            prop.properties = new SelectList(Models.ReportingMethods.getActiveProperties(), prop.selectedProp);

            report = Models.ReportingMethods.getSortedReservationList("propName", prop.selectedProp, DateTime.Now.AddMonths(-1), DateTime.Now.AddMonths(1), true, true);
        }

        public ApartmentReservationModel(string sortType, string propName, DateTime from, DateTime to, bool showAll, bool ascen)
        {
            if (sortType == null || sortType == "") { sortType = "propName";}

            prop.selectedProp = propName;
            prop.properties = new SelectList(Models.ReportingMethods.getActiveProperties(), prop.selectedProp);

            report = Models.ReportingMethods.getSortedReservationList(sortType, prop.selectedProp, from, to, showAll, ascen);
        }
    }
}